<?php
function DeleteRecursive($dir) {
		if(is_dir($dir)) {
			$files = scandir($dir);
			foreach ($files as $file)
			if ($file != "." && $file != "..") DeleteRecursive("$dir/$file");
			rmdir($dir);
		}	else if(file_exists($dir)) unlink($dir);
}

require_once('../../conf/main.conf.php');
if(isset($_REQUEST['files']) && !empty($_REQUEST['files'])) {
  foreach($_REQUEST['files'] as $file) {
			DeleteRecursive($_SESSION['dir'].$file);
		}
		die("Success: [".count($_REQUEST['files'])."] items deleted successfully!");
}
else die("Unauthorized access");
?>
